summaryrefslogtreecommitdiffstats
path: root/src/audio/sampman_miles.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/sampman_miles.cpp')
-rw-r--r--src/audio/sampman_miles.cpp125
1 files changed, 74 insertions, 51 deletions
diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp
index d0c7992c..0ba6b544 100644
--- a/src/audio/sampman_miles.cpp
+++ b/src/audio/sampman_miles.cpp
@@ -73,7 +73,7 @@ char _aHDDPath[MAX_PATH];
bool8 _bSampmanInitialised = FALSE;
-
+#ifdef EXTERNAL_3D_SOUND
//
// Miscellaneous globals / defines
@@ -92,11 +92,12 @@ S32 curprovider=-1;
S32 usingEAX=0;
S32 usingEAX3=0;
HPROVIDER opened_provider=0;
-H3DSAMPLE opened_samples[MAXCHANNELS ? MAXCHANNELS : 1] = {0};
+H3DSAMPLE opened_samples[MAXCHANNELS] = {0};
+#endif
HSAMPLE opened_2dsamples[MAX2DCHANNELS] = {0};
HDIGDRIVER DIG;
+#ifdef EXTERNAL_3D_SOUND
S32 speaker_type=0;
-
U32 _maxSamples;
float _fPrevEaxRatioDestination;
bool8 _usingMilesFast2D;
@@ -263,6 +264,7 @@ set_new_provider(S32 index)
return FALSE;
}
+#endif
cSampleManager::cSampleManager(void) :
m_nNumberOfProviders(0)
@@ -275,6 +277,7 @@ cSampleManager::~cSampleManager(void)
}
+#ifdef EXTERNAL_3D_SOUND
void
cSampleManager::SetSpeakerConfig(int32 which)
{
@@ -353,6 +356,7 @@ cSampleManager::SetCurrent3DProvider(uint8 nProvider)
else
return curprovider;
}
+#endif
static bool8
_ResolveLink(char const *path, char *out)
@@ -823,9 +827,11 @@ cSampleManager::ReleaseDigitalHandle(void)
{
if ( DIG )
{
+#ifdef EXTERNAL_3D_SOUND
prevprovider = curprovider;
release_existing();
curprovider = -1;
+#endif
AIL_digital_handle_release(DIG);
}
}
@@ -836,8 +842,10 @@ cSampleManager::ReacquireDigitalHandle(void)
if ( DIG )
{
AIL_digital_handle_reacquire(DIG);
+#ifdef EXTERNAL_3D_SOUND
if ( prevprovider != -1 )
set_new_provider(prevprovider);
+#endif
}
}
@@ -866,7 +874,8 @@ cSampleManager::Initialise(void)
m_nMonoMode = 0;
}
-
+
+#ifdef EXTERNAL_3D_SOUND
// miles
TRACE("MILES");
{
@@ -887,6 +896,7 @@ cSampleManager::Initialise(void)
for ( int32 i = 0; i < MAXCHANNELS; i++ )
opened_samples[i] = NULL;
}
+#endif
// banks
TRACE("banks");
@@ -939,8 +949,10 @@ cSampleManager::Initialise(void)
Terminate();
return FALSE;
}
-
+
+#ifdef EXTERNAL_3D_SOUND
add_providers();
+#endif
if ( !InitialiseSampleBanks() )
{
@@ -1188,7 +1200,8 @@ cSampleManager::Initialise(void)
TRACE("providerset");
{
_bSampmanInitialised = TRUE;
-
+
+#ifdef EXTERNAL_3D_SOUND
U32 n = 0;
while ( n < m_nNumberOfProviders )
@@ -1206,6 +1219,7 @@ cSampleManager::Initialise(void)
Terminate();
return FALSE;
}
+#endif
}
TRACE("bank");
@@ -1300,8 +1314,10 @@ cSampleManager::Terminate(void)
opened_2dsamples[i] = NULL;
}
}
-
+
+#ifdef EXTERNAL_3D_SOUND
release_existing();
+#endif
_DeleteMP3Entries();
@@ -1411,6 +1427,7 @@ cSampleManager::UpdateEffectsVolume(void) //[Y], cSampleManager::UpdateSoundBuff
{
for ( int32 i = 0; i < MAXCHANNELS+MAX2DCHANNELS; i++ )
{
+#ifdef EXTERNAL_3D_SOUND
if ( i < MAXCHANNELS )
{
if ( opened_samples[i] && GetChannelUsedFlag(i) )
@@ -1423,6 +1440,7 @@ cSampleManager::UpdateEffectsVolume(void) //[Y], cSampleManager::UpdateSoundBuff
}
}
else
+#endif
{
if ( opened_2dsamples[i - MAXCHANNELS] )
{
@@ -1628,6 +1646,7 @@ cSampleManager::GetSampleLength(uint32 nSample)
bool8
cSampleManager::UpdateReverb(void)
{
+#ifdef EXTERNAL_3D_SOUND
if ( !usingEAX )
return FALSE;
@@ -1700,20 +1719,19 @@ cSampleManager::UpdateReverb(void)
_fPrevEaxRatioDestination = fRatio;
return TRUE;
+#endif
+ return FALSE;
}
void
cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
{
-#ifdef EXTERNAL_3D_SOUND
case CHANNEL_POLICE_RADIO:
-#else
- default:
-#endif
{
b2d = TRUE;
break;
@@ -1733,25 +1751,24 @@ cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag)
AIL_set_3D_sample_effects_level(opened_samples[nChannel], 0.0f);
}
}
+#endif
}
bool8
cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
{
-#ifdef EXTERNAL_3D_SOUND
case CHANNEL_POLICE_RADIO:
-#else
- default:
-#endif
{
b2d = TRUE;
break;
}
}
+#endif
int32 addr;
@@ -1771,9 +1788,11 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
addr = nPedSlotSfxAddr[slot];
}
-
+
+#ifdef EXTERNAL_3D_SOUND
if ( b2d )
{
+#endif
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
{
AIL_set_sample_address(opened_2dsamples[nChannel - MAXCHANNELS], (void *)addr, m_aSamples[nSfx].nSize);
@@ -1781,6 +1800,7 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
}
else
return FALSE;
+#ifdef EXTERNAL_3D_SOUND
}
else
{
@@ -1801,8 +1821,10 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
return TRUE;
}
+#endif
}
+#ifdef EXTERNAL_3D_SOUND
void
cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
{
@@ -1837,21 +1859,20 @@ cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin)
if ( opened_samples[nChannel] )
AIL_set_3D_sample_distances(opened_samples[nChannel], fMax, fMin);
}
+#endif
void
cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
{
uint32 vol = nVolume;
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
-
+
+#ifdef EXTERNAL_3D_SOUND
switch ( nChannel )
{
-#ifdef EXTERNAL_3D_SOUND
case CHANNEL_POLICE_RADIO:
-#else
- default:
-#endif
{
+#endif
nChannelVolume[nChannel] = vol;
// increase the volume for JB.MP3 and S4_BDBD.MP3
@@ -1867,47 +1888,46 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
AIL_set_sample_volume(opened_2dsamples[nChannel - MAXCHANNELS],
m_nEffectsFadeVolume*vol*m_nEffectsVolume >> 14);
}
-
+
+#ifdef EXTERNAL_3D_SOUND
break;
}
}
+#endif
}
void
cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
{
+#ifdef EXTERNAL_3D_SOUND
switch ( nChannel )
{
-#ifdef EXTERNAL_3D_SOUND
case CHANNEL_POLICE_RADIO:
-#else
- default:
-#endif
{
-#ifndef FIX_BUGS
+#endif
+#if !defined(FIX_BUGS) && defined(EXTERNAL_3D_SOUND)
if ( opened_samples[nChannel - MAXCHANNELS] ) // BUG
#else
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
#endif
AIL_set_sample_pan(opened_2dsamples[nChannel - MAXCHANNELS], nPan);
+#ifdef EXTERNAL_3D_SOUND
break;
}
}
+#endif
}
void
cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
{
-#ifdef EXTERNAL_3D_SOUND
case CHANNEL_POLICE_RADIO:
-#else
- default:
-#endif
{
b2d = TRUE;
break;
@@ -1916,28 +1936,28 @@ cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq)
if ( b2d )
{
+#endif
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
AIL_set_sample_playback_rate(opened_2dsamples[nChannel - MAXCHANNELS], nFreq);
+#ifdef EXTERNAL_3D_SOUND
}
else
{
if ( opened_samples[nChannel] )
AIL_set_3D_sample_playback_rate(opened_samples[nChannel], nFreq);
}
+#endif
}
void
cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
{
-#ifdef EXTERNAL_3D_SOUND
case CHANNEL_POLICE_RADIO:
-#else
- default:
-#endif
{
b2d = TRUE;
break;
@@ -1946,28 +1966,28 @@ cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 n
if ( b2d )
{
+#endif
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
AIL_set_sample_loop_block(opened_2dsamples[nChannel - MAXCHANNELS], nLoopStart, nLoopEnd);
+#ifdef EXTERNAL_3D_SOUND
}
else
{
if ( opened_samples[nChannel] )
AIL_set_3D_sample_loop_block(opened_samples[nChannel], nLoopStart, nLoopEnd);
}
+#endif
}
void
cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
{
-#ifdef EXTERNAL_3D_SOUND
case CHANNEL_POLICE_RADIO:
-#else
- default:
-#endif
{
b2d = TRUE;
break;
@@ -1976,28 +1996,28 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
if ( b2d )
{
+#endif
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
AIL_set_sample_loop_count(opened_2dsamples[nChannel - MAXCHANNELS], nLoopCount);
+#ifdef EXTERNAL_3D_SOUND
}
else
{
if ( opened_samples[nChannel] )
AIL_set_3D_sample_loop_count(opened_samples[nChannel], nLoopCount);
}
+#endif
}
bool8
cSampleManager::GetChannelUsedFlag(uint32 nChannel)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
{
-#ifdef EXTERNAL_3D_SOUND
case CHANNEL_POLICE_RADIO:
-#else
- default:
-#endif
{
b2d = TRUE;
break;
@@ -2006,10 +2026,12 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel)
if ( b2d )
{
+#endif
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
return AIL_sample_status(opened_2dsamples[nChannel - MAXCHANNELS]) == SMP_PLAYING;
else
return FALSE;
+#ifdef EXTERNAL_3D_SOUND
}
else
{
@@ -2018,21 +2040,19 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel)
else
return FALSE;
}
+#endif
}
void
cSampleManager::StartChannel(uint32 nChannel)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
{
-#ifdef EXTERNAL_3D_SOUND
case CHANNEL_POLICE_RADIO:
-#else
- default:
-#endif
{
b2d = TRUE;
break;
@@ -2041,28 +2061,28 @@ cSampleManager::StartChannel(uint32 nChannel)
if ( b2d )
{
+#endif
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
AIL_start_sample(opened_2dsamples[nChannel - MAXCHANNELS]);
+#ifdef EXTERNAL_3D_SOUND
}
else
{
if ( opened_samples[nChannel] )
AIL_start_3D_sample(opened_samples[nChannel]);
}
+#endif
}
void
cSampleManager::StopChannel(uint32 nChannel)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
{
-#ifdef EXTERNAL_3D_SOUND
case CHANNEL_POLICE_RADIO:
-#else
- default:
-#endif
{
b2d = TRUE;
break;
@@ -2071,8 +2091,10 @@ cSampleManager::StopChannel(uint32 nChannel)
if ( b2d )
{
+#endif
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
AIL_end_sample(opened_2dsamples[nChannel - MAXCHANNELS]);
+#ifdef EXTERNAL_3D_SOUND
}
else
{
@@ -2082,6 +2104,7 @@ cSampleManager::StopChannel(uint32 nChannel)
AIL_end_3D_sample(opened_samples[nChannel]);
}
}
+#endif
}
void